/* Modern Chat UI Styles */

:root {
  --chat-bg: #f8f9fa;
  --chat-container-bg: #ffffff;
  --user-bg: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
  --user-text: #262626;
  --assistant-bg: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  --assistant-text: #262626;
  --border-color: #e8e8e8;
  --input-bg: #fff;
  --placeholder-text: #8c8c8c;
  --timestamp-text: #8c8c8c;
  --primary-color: #1890ff;
  --primary-hover-color: #40a9ff;
  --shadow-light: rgba(0, 0, 0, 0.04);
  --shadow-medium: rgba(0, 0, 0, 0.08);
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  background-color: var(--chat-container-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow-light), 0 4px 16px var(--shadow-medium);
  border: 1px solid var(--border-color);
}

.chat-header {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.graph-selector-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--chat-bg);
  padding: 10px 20px;
  border-radius: 12px;
  color: #595959;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
}

.graph-selector-container .anticon {
  font-size: 16px;
  color: var(--primary-color);
}

.graph-selector {
  min-width: 180px;
}

.graph-selector .ant-select-selector {
  background-color: transparent !important;
  padding-left: 8px !important;
}

.messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  background-color: var(--chat-bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty {
  text-align: center;
  margin: auto;
  color: var(--placeholder-text);
  font-size: 1rem;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 85%;
  animation: message-fade-in 0.3s ease-out;
}

@keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-row.assistant {
  align-self: flex-start;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 2px 8px var(--shadow-light);
}

.user .avatar {
  background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}

.assistant .avatar {
  background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
}

.content {
  display: flex;
  flex-direction: column;
}

.user .content {
  align-items: flex-end;
}

.assistant .content {
  align-items: flex-start;
}

.bubble {
  padding: 14px 18px;
  border-radius: 20px;
  box-shadow: 0 2px 8px var(--shadow-light);
  max-width: 100%;
  word-wrap: break-word;
}

.user .bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 6px;
}

.assistant .bubble {
  background: var(--assistant-bg);
  color: var(--assistant-text);
  border-bottom-left-radius: 6px;
}

.timestamp {
  font-size: 12px;
  color: var(--timestamp-text);
  margin-top: 6px;
  padding: 0 4px;
}

.input-area {
  padding: 20px 32px;
  border-top: 1px solid var(--border-color);
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.02);
}

.input-area .ant-input-textarea-wrapper {
  flex-grow: 1;
}

.input-area .ant-input {
  background-color: var(--input-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  box-shadow: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-area .ant-input:focus,
.input-area .ant-input:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.input-area .ant-btn-primary {
  border-radius: 12px;
  height: 48px;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.input-area .ant-btn-primary:hover {
  box-shadow: 0 6px 16px rgba(24, 144, 255, 0.35);
  transform: translateY(-1px);
}

.typing .bubble {
  padding: 12px 16px;
}

.dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: #b0b0b0;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Markdown content styles */
.md-content {
  font-size: 14px;
  line-height: 1.8;
  color: #262626;
}
.md-content p:last-child {
  margin-bottom: 0;
}
.md-content p {
  margin-bottom: 12px;
}
.md-content pre {
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  margin: 12px 0;
}
.md-content code {
  background-color: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #262626;
}
.md-content pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: #d4d4d4;
}

/* Assistant content styles */
.assistant-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.center-entity-tag {
  display: flex;
  align-items: center;
}

/* Reference content container */
.reference-content {
  display: flex;
  flex-direction: column;
}

/* Visualization section */
.visualization-section {
  margin-bottom: 0;
}

.visualization-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  border-radius: 8px;
  border: 1px solid #e8e8e8;
  transition: all 0.3s ease;
}

.visualization-image-wrapper:hover {
  background: linear-gradient(135deg, #f5f5f5 0%, #ececec 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.visualization-image-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ant Design Image 组件覆盖 */
.visualization-image-wrapper .ant-image {
  width: 100%;
}

.visualization-image-wrapper .ant-image-img {
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.visualization-image-wrapper .ant-image:hover .ant-image-img {
  transform: scale(1.02);
}

/* Paths section */
.paths-section {
  padding-top: 0;
}

/* Paths list styles */
.paths-list {
  margin: 8px 0;
  padding-left: 20px;
  list-style-type: none;
}

.paths-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.paths-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #1890ff;
  font-weight: bold;
}

/* Collapse customization */
.assistant-content .ant-collapse {
  background: transparent;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
}

.assistant-content .ant-collapse-header {
  padding: 10px 16px !important;
  border-radius: 8px !important;
}

.assistant-content .ant-collapse-content {
  background: rgba(250, 250, 250, 0.5);
}

.assistant-content .ant-collapse-content-box {
  padding: 12px 16px !important;
}